package xkp.lesson4;

public class Person extends Object{
	 String name;
	private int age;
	private String birthday;

	public Person() {
		//System.out.println("Person ");
	}
	

	public Person(int age) {
		this.age = age;
	}

	public Person(String name) {
		this.name = name;
	}

	public Person(int age, String name) {
		//this(参数);是调用构造方法，注意改行代码必须放在另外一个构造方法的第一行。
		this(age);
		//this(name);
		this.name = name;
	}


	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getName() {
		return name==null?"":name;
	}

	public void setName(String name) {
		this.name = name;
	}

	protected int getAge() {
		return age;
	}

	public void setAge(int age) {
		if(age > 150 || age <0) {
			System.out.println("年龄有误，请重新设置");
			return;
		}
		this.age = age;
	}
	
	public void fun1() {
		
	}

	
	public void eat() {
		System.out.println("什么都吃！！！！");
	}
}
